{% extends 'layouts/base.html' %}
{% block content %}
<form action="{{url('index/Mobileregister/reseting')}}" method="post">
  <div id="container" class="bj_color info_content_wrap">
        <div class="weui_cells weui_cells_access">
             <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                    <label class="weui_label">客户姓名</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    <input class="weui_input" type="tel" name="client_name" placeholder="请输入姓名" value="{{info.client_name}}"/>
                </div>  
            </div>
            <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                    <label class="weui_label">客户姓名</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    <input class="weui_input" type="tel" name="client_phone" placeholder="请输入手机号码" value="{{info.client_phone}}"/>
                </div>  
            </div>
            <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                    <label class="weui_label">出发地址</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    <input class="weui_input" name="start_address" type="tel" placeholder="请输入地址" value="{{info.start_address}}"/>
                </div>  
            </div>
            <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                    <label class="weui_label">目的地址</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    <input class="weui_input" type="tel" name="arrive_address" placeholder="请输入地址" value="{{info.arrive_address}}"/>
                </div>  
            </div>
            <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                   <label class="weui_label">搬运日期</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                     <input class="weui_input" type="date" name="carrydate" placeholder="请输入地址" value="{{info.carrydate|date('Y-m-d')}}" />
                </div>  
            </div>
        </div> 

      <div class="btn_box">
           <a href="javascript:;" class="weui_btn submit_btn" id="showAlter">修改</a>
      </div> 
      <!--此为弹窗-->
      <div class="weui_dialog_confirm" id="Alter" style="display: none;">
          <div class="weui_mask"></div>
          <div class="weui_dialog">
              <div class="weui_dialog_hd"><strong class="weui_dialog_title">确定修改订单信息</strong></div>
              <div class="weui_dialog_bd">一旦修改不可再操作<br>...</div>
              <div class="weui_dialog_ft">
                  <a href="javascript:;" id="cancel" class="weui_btn_dialog default">取消</a>
                  <a href="javascript:;" id="comfirm" class="weui_btn_dialog sure_btn">确定</a>
              </div>
          </div>
      </div>      
  </div> 
    <input type="hidden" name="openid" value="{{info.openid}}">
    <input type="hidden" name="order_number" value="{{info.order_number}}">
 </form>
{% endblock %}
{% block script %}
<script src="{{config['application']['site']['assetsUri']}}front/js/jquery.min.js"></script>
<script src="{{config['application']['site']['assetsUri']}}front/js/jquery.validate.min.js"></script>
<script>
      $(function(){
             $("#showAlter").click(
                  function(){
                      $('#Alter').show();
                      $('#Alter').find('.weui_btn_dialog').on('click', function () {
                          $('#Alter').hide();
                      });
                  }
              );
      
              //确定
            $('#comfirm').click(function(){
                $('form').submit();
            });
            
            // 手机号码验证
            jQuery.validator.addMethod("isMobile", function(value, element) {
                var length = value.length;
                var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
                return this.optional(element) || (length == 11 && mobile.test(value));
            }, "请正确填写您的手机号码");

            $( "form" ).validate({
                    rules: {
                        client_name: {
                                required: true,
                                maxlength:10
                        },
                        client_phone: {
                                required: true,
                                isMobile: true
                        },
                        carrydate:{
                                required: true
                        },
                        start_address: {
                                required: true,
                                maxlength: 50
                        },
                        driver_address: {
                                required: true,
                                maxlength: 50,
                        },
                    },
                    messages:{
                        client_name:{
                            required: '请输入您的姓名！',
                            maxlength:'长度不能超过10个字符！'
                        },
                        client_phone:{
                            required: '手机号码不能为空！',
                            isMobile : '请正确填写您的手机号码！'
                        },
                        carrydate:{
                            required: '请输入预约日期！'
                        },
                        start_address:{
                            required: '请输入起始地！',
                            maxlength: '不能超过50个字符！'
                        },
                        driver_address:{
                            required: '请输入目的地！',
                            maxlength: '不能超过50个字符！'
                        },
                    }
            });
                
});
    
    
   </script>
{% endblock %}
